#include "src/scene/material.h"

Material::Material(){
	ambient.red = 1.0;
	ambient.green = 1.0;
	ambient.blue = 1.0;
	ambient.alpha = 1.0;

    diffuse.red = 0.6;
	diffuse.green = 0.6;
	diffuse.blue = 0.6;
	diffuse.alpha = 1.0;

	specular.red = 0.6;
	specular.green = 0.6;
	specular.blue = 0.6;
	specular.alpha = 1.0;

	specularPower = 80;
    ka = kd = ks = 0.5;
    kt = refractiveIndex = 0;

    texture = NULL;
    bumpMapping = NULL;
}

Material::Material(double _ambient, double _diffuse, double _specular, double _specularPower, double _ka, double _kd, double _ks, double _kt, double _refractiveIndex, Texture *_texture, BumpMapping *_bumpMapping){
	ambient.red = _ambient;
	ambient.green = _ambient;
	ambient.blue = _ambient;
	ambient.alpha = 1.0;

    diffuse.red = _diffuse;
	diffuse.green = _diffuse;
	diffuse.blue = _diffuse;
	diffuse.alpha = 1.0;

	specular.red = _specular;
	specular.green = _specular;
	specular.blue = _specular;
	specular.alpha = 1.0;

	specularPower = _specularPower;
	ka = _ka;
	kd = _kd;
	ks = _ks;
	kt = _kt;
    refractiveIndex = _refractiveIndex;

    texture = _texture;
    bumpMapping = _bumpMapping;
}

Material::Material(const Color &_ambient, const Color &_diffuse, const Color &_specular, double _specularPower, double _ka, double _kd, double _ks, double _kt, double _refractiveIndex, Texture *_texture, BumpMapping *_bumpMapping){
	ambient = _ambient;
    diffuse = _diffuse;
    specular = _specular;

	specularPower = _specularPower;
	ka = _ka;
	kd = _kd;
	ks = _ks;
	kt = _kt;
    refractiveIndex = _refractiveIndex;

    texture = _texture;
    bumpMapping = _bumpMapping;
}

Material::~Material(){
}
//
//void Material::setAmbient(const Color &_ambient){
//	ambient = _ambient;
//}
//
//const Color &Material::getAmbient() const{
//	return ambient;
//}
//
//void Material::setDiffuse(const Color &_diffuse){
//	diffuse = _diffuse;
//}
//
//const Color &Material::getDiffuse() const{
//	return diffuse;
//}
//
//void Material::setSpecular(const Color &_specular){
//	specular = _specular;
//}
//
//const Color &Material::getSpecular() const{
//	return specular;
//}

GLfloat *Material::getAmbientGL(GLfloat _v[]) const
{
    return ambient.toGL(_v, kt);
}

GLfloat *Material::getDiffuseGL(GLfloat _v[]) const
{
    return diffuse.toGL(_v, kt);
}

GLfloat *Material::getSpecularGL(GLfloat _v[]) const
{
    return specular.toGL(_v, kt);
}
